package demo1;

public class Company {
    public static void main(String[] args) {
        Company company1 = new Company();
        Company company2 = new Company();
        Company company3 = new Company();

        //这里因为对象是new出来的，所以hashCode值是不一致的
        System.out.println(company1.hashCode() == company2.hashCode() && company2.hashCode() == company3.hashCode());

        Class<? extends Company> aClass1 = company1.getClass();
        Class<? extends Company> aClass2 = company2.getClass();
        Class<? extends Company> aClass3 = company3.getClass();

        //这里通过getClass获取类，所以hashCode值是一致的
        System.out.println((aClass1.hashCode() == aClass2.hashCode()) && (aClass2.hashCode() == aClass3.hashCode()));

    }
}
